package com.atwisdom.star.core.bsl.allModel.Impl;

import com.alibaba.fastjson.JSONObject;
import com.atwisdom.star.common.vo.JsonResult;
import com.atwisdom.star.common.vo.ResultInfo;
import com.atwisdom.star.core.bsl.allModel.ModelBslService;
import com.atwisdom.star.core.bsl.allModel.vo.AllModel;
import com.atwisdom.star.core.dsl.modelClass.consume.Impl.ConsumeModelDslServiceImpl;
import com.atwisdom.star.core.dsl.modelClass.logic.Impl.LogicModelDslServiceImpl;
import com.atwisdom.star.core.dsl.modelClass.resource.Impl.ResourceModelDslServiceImpl;
import com.atwisdom.star.core.dsl.modelClass.routing.Impl.RoutingModelDslServiceImpl;
import com.atwisdom.star.core.dsl.modelClass.staticLogic.Impl.StaticLogicModelDslServiceImpl;
import com.atwisdom.star.core.dsl.modelClass.tank.Impl.TankModelDslServiceImpl;
import com.atwisdom.star.core.dsl.modelClass.template.Impl.TemplateModelDslServiceImpl;
import com.atwisdom.star.core.dsl.modelClass.twins.Impl.TwinsModelDslServiceImpl;
import com.atwisdom.star.core.dsl.modelClass.workCenter.Impl.WorkCenterModelDslServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class ModelBslServiceImpl implements ModelBslService {

    private ConsumeModelDslServiceImpl consumeModelDslService;

    private ResourceModelDslServiceImpl resourceModelDslService;
    private LogicModelDslServiceImpl logicModelDslService;
    private StaticLogicModelDslServiceImpl staticLogicModelDslService;
    private TwinsModelDslServiceImpl twinsModelDslService;
    private TankModelDslServiceImpl tankModelDslService;
    private RoutingModelDslServiceImpl routingModelDslService;
    private WorkCenterModelDslServiceImpl workCenterModelDslService;
    private TemplateModelDslServiceImpl templateModelDslService;
    @Autowired
    public void setResourceModelDslService(ResourceModelDslServiceImpl resourceModelDslService) {
        this.resourceModelDslService = resourceModelDslService;
    }
    @Autowired
    public void setLogicModelDslService(LogicModelDslServiceImpl logicModelDslService) {
        this.logicModelDslService = logicModelDslService;
    }
    @Autowired
    public void setStaticLogicModelDslService(StaticLogicModelDslServiceImpl staticLogicModelDslService) {
        this.staticLogicModelDslService = staticLogicModelDslService;
    }
    @Autowired
    public void setTwinsModelDslService(TwinsModelDslServiceImpl twinsModelDslService) {
        this.twinsModelDslService = twinsModelDslService;
    }
    @Autowired
    public void setTankModelDslService(TankModelDslServiceImpl tankModelDslService) {
        this.tankModelDslService = tankModelDslService;
    }
    @Autowired
    public void setRoutingModelDslService(RoutingModelDslServiceImpl routingModelDslService) {
        this.routingModelDslService = routingModelDslService;
    }
    @Autowired
    public void setRoutingModelDslService(WorkCenterModelDslServiceImpl workCenterModelDslService) {
        this.workCenterModelDslService = workCenterModelDslService;
    }
    @Autowired
    public void setTemplateModelDslService(TemplateModelDslServiceImpl templateModelDslService) {
        this.templateModelDslService = templateModelDslService;
    }
    @Autowired
    public void setConsumeModelDslService(ConsumeModelDslServiceImpl consumeModelDslService) {
        this.consumeModelDslService = consumeModelDslService;
    }

    /**
     * 获取所系统模型
     * @return 返回值
     */
    @Override
    public ResultInfo<AllModel> getAllModel() {
        List<JSONObject> consumeModels = consumeModelDslService.queryAll();
        List<JSONObject> resourceModels = resourceModelDslService.queryAll();
        List<JSONObject> logicModels = logicModelDslService.queryAll();

        List<JSONObject> staticLogicModels = staticLogicModelDslService.queryAll();
        List<JSONObject> tankModels = tankModelDslService.queryAll();
        List<JSONObject> twinsModels = twinsModelDslService.queryAll();

        List<JSONObject> routingModels = routingModelDslService.queryAll();
        List<JSONObject> workCenterModels = workCenterModelDslService.queryAll();
        List<JSONObject> templateModels = templateModelDslService.queryAll();

        AllModel allModel = new AllModel();
        allModel.setConsumeModels(consumeModels);
        allModel.setResourceModels(resourceModels);
        allModel.setLogicModels(logicModels);
        allModel.setStaticLogicModels(staticLogicModels);
        allModel.setTankModels(tankModels);
        allModel.setTwinsModels(twinsModels);
        allModel.setRoutingModels(routingModels);
        allModel.setWorkCenterModels(workCenterModels);
        allModel.setTemplateModels(templateModels);
        return  JsonResult.success(allModel);
    }
}
